package com.cy.pj.sys.pojo;

import lombok.Data;

@Data
public class JsonResult {
    private Integer state = 1;
    private String message = "ok";
    private Object data;

    public JsonResult(){}

    public JsonResult(String message){
        //new JsonResult(list)
        this.message=message;
    }

    public JsonResult(Integer state,String message){
        this(message);
        this.state=state;
    }

    public JsonResult(Object data){
        //new JsonResult(list)
        this.data=data;
    }

    //当出现异常时,可以通过此构造方法对异常信息进行封装
    public JsonResult(Throwable e){
        //new JsonResult(exception);
        this(0,e.getMessage());
    }
}
